﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XMLSpredGear.Core;

namespace XMLSpredGear.Templates
{
    public class Cells<T>:BaseElement
        where T:Cell
    {
        IList<T> listt;
        public Cells(string strLocalName)
            : base(strLocalName)
        {
            listt = new List<T>();
        }

        public void Add(T objdata)
        {
            listt.Add(objdata);
        }

        public T this[int i]
        {
            get
            {
                return listt[i];
            }
            set
            {
                listt.Insert(i, value);
            }
        }

        internal protected override IDictionary<string, string> RegisterElements()
        {
            IDictionary<string, string> dic = new Dictionary<string, string>();
            foreach (T item in listt)
            {
                dic.Add("Cell", item.ToString());
            }
            return dic;
        }

        internal protected override IDictionary<string, string> RegisterAttributes()
        {
            IDictionary<string, string> dic = new Dictionary<string, string>();
            return dic;
        }
    }
}
